home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / catD / XIO_PACK.z / XIO_PACK
Encoding:
Text File  |  2002-10-03  |  4.8 KB  |  133 lines

  1.  
  2.  
  3.  
  4. XXXXIIIIOOOO____PPPPAAAACCCCKKKK((((DDDD3333))))                                                      XXXXIIIIOOOO____PPPPAAAACCCCKKKK((((DDDD3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _XXXX_IIII_OOOO______PPPP_AAAA_CCCC_KKKK - build a packed XIO address
  10.      _XXXX_IIII_OOOO______PPPP_AAAA_CCCC_KKKK_EEEE_DDDD - check if XIO address is packed
  11.      _XXXX_IIII_OOOO______PPPP_OOOO_RRRR_TTTT - extract port from packed XIO address
  12.      _XXXX_IIII_OOOO______AAAA_DDDD_DDDD_RRRR - extract offset from packed XIO address
  13.      _XXXX_IIII_OOOO______NNNN_OOOO_WWWW_HHHH_EEEE_RRRR_EEEE - nonexistent XIO target
  14.  
  15. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  16.      #include <sys/xtalk/xtalk.h>
  17.  
  18.      /*
  19.      ** These are really macros, but
  20.      ** if they were functions:
  21.      */
  22.  
  23.      iopaddr_t
  24.      XIO_PACK(xwidgetnum_t _p_o_r_t, iopaddr_t _o_f_f_s_e_t)
  25.  
  26.      int
  27.      XIO_PACKED(iopaddr_t _x_a_d_d_r)
  28.  
  29.      xwidgetnum_t
  30.      XIO_PORT(iopaddr_t _x_a_d_d_r)
  31.  
  32.      iopaddr_t
  33.      XIO_ADDR(iopaddr_t _x_a_d_d_r)
  34.  
  35.      iopaddr_t XIO_NOWHERE;
  36.  
  37.    AAAArrrrgggguuuummmmeeeennnnttttssss
  38.      _o_f_f_s_e_t  is an appropriate 48-bit XIO address (offset).
  39.  
  40.      _p_o_r_t    is a 4-bit XIO target port number.
  41.  
  42.      _x_a_d_d_r   is
  43.  
  44. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  45.      _X_I_O__P_A_C_K() merges an XIO target port number with the XIO target address
  46.      offset into a single number that can be efficiently passed and returned.
  47.  
  48.      _X_I_O__P_A_C_K_E_D() returns nonzero if the parameter is a packed XIO address, or
  49.      zero if the parameter represents an offset, and the XIO target must be
  50.      inferred by the device driver (which should use its assigned XIO "master"
  51.      port).
  52.  
  53.      _X_I_O__P_O_R_T() extracts the target port number from a packed address.
  54.  
  55.      _X_I_O__A_D_D_R() extracts the target address from a packed address.
  56.  
  57.      _X_I_O__N_O_W_H_E_R_E is a constant containing a packed XIO address that represents
  58.      an impossible DMA target.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. XXXXIIIIOOOO____PPPPAAAACCCCKKKK((((DDDD3333))))                                                      XXXXIIIIOOOO____PPPPAAAACCCCKKKK((((DDDD3333))))
  71.  
  72.  
  73.  
  74.      The most common use of packed addresses is when XIO DMA target
  75.      translation results are returned, and it is expected that only rarely
  76.      will packed addresses actually be used, since nearly all DMA is directed
  77.      via the device's assigned master port to system memory.  However, it is
  78.      advised that all drivers using xtalk_dma services watch for and handle
  79.      packed addresses.
  80.  
  81.      There are a number of objects in the system which the CPU can directly
  82.      access, but which devices can not access over the XIO bus.  While it is
  83.      rare to see XIO_PACKED addresses, it should be even more rare to see
  84.      XIO_NOWHERE; this represents either a programming error in the device
  85.      driver, or an attempt by a user to initiate DMA somewhere silly.
  86.  
  87. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  88.      The following is a contrived example of some interrupt code servicing a
  89.      simple DMA engine on an XIO card.
  90.           xaddr = xtalk_dmamap_addr(dmamap, paddr, size);
  91.  
  92.           if (XIO_PACKED(xaddr)) {
  93.                if (xaddr == XIO_NOWHERE)
  94.                     goto fail;
  95.                xport = XIO_PORT(xaddr);
  96.                xaddr = XIO_ADDR(xaddr);
  97.           } else
  98.                xport = soft->master_port;
  99.  
  100.           regs->xaddr = xaddr;
  101.           regs->xport = port;
  102.           regs->bytes = size;
  103.           regs->command = DMA_GO;
  104.  
  105. NNNNOOOOTTTTEEEESSSS
  106.      Backward compatibility dictates the format of the unpacked address:  it
  107.      must be a bare offset, and implicitly refers to a particular device's XIO
  108.      master device, assigned previously.  The most convenient encoding to use
  109.      for packed XIO addresses results in packed addresses to IO port 0 being
  110.      undifferentiable from unpacked values.  This results in the limitation
  111.      that setting up peer-to-peer DMA to XIO widget 0 is not possible; this
  112.      restriction is acceptable, since the device answering at XIO widget 0 is
  113.      not a reasonable DMA target.
  114.  
  115. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  116.      xtalk_dma(D3)
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.